<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <link rel="stylesheet" href="/static/admin/admin/course/public/admin/style.css" />
    <link rel="stylesheet" href="/static/admin/admin/course/public/admin/dashicons.css">
    <script src="/static/admin/admin/course/public/admin/jquery.min.js"></script>
    <script src="/static/admin/admin/course/public/admin/ckeditor/ckeditor.js"></script>

</head>

<body>
    <form class="layui-form" action="">
        <div class="wrap wrap-course-edit">
            <h1>课程管理</h1>
            <div class="tab">
                <a href="admin-course-edit.html" class="curr">课程信息</a>
                <a href="admin-video-edit.html" class="">配置视频</a>
                <a href="admin-question-edit.html" class="">配置习题</a>
            </div>
            <div class="tips"></div>
            <div class="box">
                <div class="box-title">编辑课程</div>
                <div class="box-body">
                    <form method="post" action="/?p=admin&c=course&a=edit&id=3&token=c15a2f6833d839516c2d95b4ce48456b"
                        enctype="multipart/form-data">
                        <table class="t-info">
                            <tr>
                                <th width="80">标题：</th>
                                <td><input type="text" name="title" value="Linux网络流媒体服务器"></td>
                            </tr>
                            <tr>
                                <th>栏目：</th>
                                <td><select name="category_id">
                                        <option value="0">无</option>
                                        <option value="1">PHP</option>
                                        <option value="8">—— MySQL</option>
                                        <option value="9">—— PHP基础</option>
                                        <option value="10" selected>—— PHP高级</option>
                                        <option value="2">Java</option>
                                        <option value="3">iOS</option>
                                        <option value="4">UI设计</option>
                                        <option value="5">前端与移动开发</option>
                                        <option value="6">C/C++</option>
                                        <option value="7">Python</option>
                                    </select></td>
                            </tr>
                            <tr class="s-price">
                                <th>价格：</th>
                                <td><input type="text" name="price" value="120.00"></td>
                            </tr>
                            <tr class="s-thumb">
                                <th>封面图片：</th>
                                <td>
                                    <input type="file" name="thumb"><span>（超过 280*156 图片将被缩小）</span>
                                    <img src="/static/admin/admin/course/public/upload/2016-05/27/bb6f9a9119596b23243b3a729b759fad.jpg"
                                        alt="封面图">
                                </td>
                            </tr>
                            <tr class="s-editor">
                                <th>课程介绍：</th>
                                <td><textarea name="content"><p>     目前计算机编程语言百花齐放，但每种语言都有其应用场景和强项。Linux内核和驱动程序开发这个领域，只能用C语言来完成，其他计算机语言在这个领域是望尘莫及的，C语言是接近汇编的高级语言，同时产生的本地代码执行效率位于高级语言之一。所以只有掌握了C语言，才能涉足linux内核开发，驱动程序开发领域。</p>
            </textarea></td>
                            </tr>
                            <tr class="s-act">
                                <th></th>
                                <td><input type="submit" value="立即发布"><input type="submit" value="保存草稿" name="save">
                                </td>
                            </tr>
                        </table>
                    </form>
                    <script src="public/admin/course.config.js"></script>
                    <script>
                        CKEDITOR.config.height = 400;
                        CKEDITOR.config.width = "100%";
                        CKEDITOR.replace("content");
                    </script>
                </div>
            </div>
        </div>
    </form>
    <script src="__ADMIN_STATIC__/layui/layui.js"></script>
    <script src="__ADMIN_STATIC__/pear/pear.js"></script>
    <script>
        layui.use(['form', 'jquery', 'func'], function () {
            let form = layui.form;
            let $ = layui.jquery;


            layui.func.assign({: json_encode($formData) });
            form.on('submit(save)', function (data) {
                $.ajax({
                    data: data.field,
                    type: 'post',
                    success: function (res) {
                        //判断有没有权限
                        if (res && res.code == 999) {
                            layer.msg(res.msg, {
                                icon: 5,
                                time: 2000,
                            })
                            return false;
                        } else if (res.code == 200) {
                            layer.msg(res.msg, { icon: 1, time: 1000 }, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                                parent.layui.table.reload("dataTable");
                            });
                        } else {
                            layer.msg(res.msg, { icon: 2, time: 1000 });
                        }
                    }
                })
                return false;
            });
        })
    </script>
</body>

</html>